<template>
  <div class="app-container">
    <div v-if="user">
      <el-row :gutter="20">

        <el-col :span="18" :xs="24">
          <el-card>
            <el-tabs v-model="activeTab">
              <el-tab-pane label="基本资料" name="account">
                <account :user="user" />
              </el-tab-pane>
              <el-tab-pane label="公司LOGO" name="logo">
                <logo :logo="user.logo" />
              </el-tab-pane>
              <el-tab-pane label="修改密码" name="password">
                <password  />
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-col>

      </el-row>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import logo from './components/Logo'
import password from './components/Password'
import Account from './components/Account'

export default {
  name: 'Profile',
  components: { logo, password, Account },
  data() {
    return {
      user: {},
      activeTab: 'account'
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'logo',
      'title',
      'mobile'
    ])
  },
  created() {
    this.getUser()
  },
  methods: {
    getUser() {
      this.user = {
        nickname: this.name,
        title: this.title,
        mobile: this.mobile,
        status: 1,
        logo: '/logo/'+this.logo
      }
    }
  }
}
</script>
